<?php

class Core_App
{
    protected function  __construct()
    {}
    
    public static function run()
    {
        $data_base = Core_Db::instance();
        //$data_base->set_db(Core_Db_Mysql::instance('fireflie.mysql.ukraine.com.ua', 'fireflie_db', 'mk37aq45mk37mk37', 'fireflie_db'));
        $data_base->set_db(Core_Db_Mysql::instance('localhost', 'root', '', 'fireflie_db'));
        $data_base->connect();

        $argv = array('route' => self::get_route());
        
        //TODO remove next row
        file_put_contents("1.1", date("m.d.Y H:i:s").": ".$argv["route"]."\n",FILE_APPEND);
        
        Core_Router::instance()->run($argv['route']);
    }

    private static function get_route()
    {
        $route = isset($_GET['route']) ? trim($_GET['route'],'/') : '';

        if ($route == 'index.php') {
            $route = '';
        }

        return $route;
    }

    
}

?>
